package njust.csc.aecore.utils

/**
 * @Author ZhouHang
 * @Date 24/6/26 周三
 */
object FilterUtils {
    private val urlWhitelist = listOf(
        "aliyuncs.com",
        "www.youtube.com",
        "api.twitch.tv"
    )

    private val sdkWhitelist = listOf(
        "java.lang",
        "org.json",
        "android.os",
        "android.support.v4",
        "java.io",
        "androidx",
        "javax",
        "kotlin"
    )

    fun filterUrl(urls: List<String>): List<String> {
        return urls.filter { url ->
            !urlWhitelist.any { whiteStr -> url.contains(whiteStr, ignoreCase = true) }
        }
    }

    fun filterSdk(sdks: List<String>): List<String> {
        return sdks.filter { sdk ->
            !sdkWhitelist.any { whiteStr -> sdk.startsWith(whiteStr, ignoreCase = true) }
        }
    }
}